package com.new2i.util;

import com.qiniu.util.Auth;

/**
 * 七牛文件上传token生成工具类
 * 
 * @since 2015/09/03
 * @author 2i
 *
 */
public class QiniuUptokenGenUtil {

	private static final String QN_ACCESS_KEY = "PVjTjaXYRg3wMZC7PVPUKF-tVoFK6ZMk8fgxsMws";
	
	private static final String QN_SECRET_KEY = "M9dyV_UBXzKaiXo2eYtAZengZ8xnDjuQcWKkrRWm";
	 
	//存储空间枚举 
	public enum BucketNameEnum { 
		
		Mch("mch-2i"),
	    Emr("mediworks-bingli"),
	    Shiqi("shiqi-2i"),
	    Chat("shiqi-2i-chat"),
	    Doctor("shiqi-2i-doctor"),
	    Consult("shiqi-2i-consult"),
	    User("shiqi-2i-user"),
	    Hospital("shiqi-2i-hospital"),
	    Sucai("shiqi-2i-sucai"),
	    File("shiqi-2i-file"),
	    Test("shiqi-2i-test"); 
		
		private String string; 
		
		private BucketNameEnum(String string){
			this.string = string;
		} 
		
		public String getString() {
			return string;
		}
	};

	public static String getUptoken(String bucketName) {  
		Auth auth = Auth.create(QN_ACCESS_KEY, QN_SECRET_KEY);
		return auth.uploadToken(bucketName);
	} 
}
